package com.gangan.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gangan.model.ActivityApply;
import com.gangan.mapper.ActivityApplyMapper;
import com.gangan.model.User;
import com.gangan.model.view.ActivityView;
import com.gangan.service.IActivityApplyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.security.Security;
import java.util.List;

/**
 * <p>
 * 活动报名表 服务实现类
 * </p>
 *
 * @author jobob
 * @since 2019-09-07
 */
@Service
public class ActivityApplyServiceImpl extends ServiceImpl<ActivityApplyMapper, ActivityApply> implements IActivityApplyService {
    @Autowired
    private ActivityApplyMapper mapper;

    @Override
    public List<ActivityView> selectMyActivityListPage(Page<ActivityView> pagination) {
        User user = (User)SecurityUtils.getSubject().getSession().getAttribute("user");
        return mapper.selectMyActivityListPage(pagination,user.getId());
    }

    @Override
    public List<ActivityView> selectMyActivityListPageByType(Page<ActivityView> pagination,Integer status) {
        User user = (User)SecurityUtils.getSubject().getSession().getAttribute("user");
        return mapper.selectMyActivityListPageByType(pagination,user.getId(),status);
    }
}
